package com.song.pj.brand.service.impl;

import com.song.pj.brand.dao.BrandsDao;
import com.song.pj.brand.pojo.Brand;
import com.song.pj.brand.service.BrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class BrandServiceImpl implements BrandService {

//    private static final Logger log = //这里的实现在springboot中默认选择的是logback
//    LoggerFactory.getLogger(BrandServiceImpl.class);
    @Autowired
    private BrandsDao brandsDao;
    @Override
    public List<Brand> findBrands(String name) {
        List<Brand> list = brandsDao.findBrands(name);
        return list;
    }

    @Override
    public int deleteBrands(Integer id) {
        int row = brandsDao.deleteBrands(id);
        return row;
    }

    @Override
    public int insertBrands(Brand brand) {
        int row = brandsDao.insertBrands(brand);
        return row;
    }

    @Override
    public int updateBrands(Brand brand) {
        int rows = brandsDao.updateBrands(brand);
        return rows;
    }

    @Override
    public Brand findById(Integer id) {
        return brandsDao.findById(id);
    }

}
